package generics.and.colecctions.ordenacion.comparator;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ClaseTestComparator {

	public static void main(String[] args) {

		ClaseBase c0 = new ClaseBase();
		c0.setApellido("Zu");
		ClaseBase c1 = new ClaseBase();
		c1.setApellido("Ramirez");
		ClaseBase c2 = new ClaseBase();
		c2.setApellido("Canseco");
		ClaseBase c3 = new ClaseBase();
		c3.setApellido("Zabala");

		List<ClaseBase> lista = new ArrayList<ClaseBase>();
		lista.add(c1);
		lista.add(c2);
		lista.add(c3);
		lista.add(c0);

		Collections.sort(lista, new ClaseImplementaComparatorApellido());

		for (ClaseBase claseBase : lista) {
			System.out.println(claseBase.getApellido());
		}
	}

}
